cmake_minimum_required(VERSION 3.8)
project(xarm_teleop_control)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# find dependencies
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(xarm_msgs REQUIRED)
find_package(xarm_api REQUIRED)
find_package(tf2_ros REQUIRED)
find_package(tf2 REQUIRED)
find_package(geometry_msgs REQUIRED)

# 包含头文件目录
include_directories(
  include
)

# 添加库文件 dh_gripper_ctl
add_library(dh_gripper_ctl
  src/dh_gripper_ctl.cpp
)

ament_target_dependencies(dh_gripper_ctl
  rclcpp
  xarm_api
  xarm_msgs
  geometry_msgs
)


add_executable(gripper_control_node src/xarm_gripper_control.cpp)


target_link_libraries(gripper_control_node
  dh_gripper_ctl
)


ament_target_dependencies(gripper_control_node
  rclcpp
  xarm_api
  xarm_msgs
  geometry_msgs
)


add_executable(xarm_teleop_control_node src/xarm_teleop_control.cpp)

ament_target_dependencies(xarm_teleop_control_node
  rclcpp
  tf2_ros
  tf2
  geometry_msgs
  xarm_api
  xarm_msgs
)



target_include_directories(xarm_teleop_control_node
  PUBLIC
  $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
  $<INSTALL_INTERFACE:include>)

target_compile_features(xarm_teleop_control_node PUBLIC cxx_std_14)

install(TARGETS
  dh_gripper_ctl
  xarm_teleop_control_node
  gripper_control_node
  DESTINATION lib/${PROJECT_NAME})

# 安装头文件
install(DIRECTORY include/
  DESTINATION include/
)

# 安装 launch 文件
install(DIRECTORY launch/
  DESTINATION share/${PROJECT_NAME}/launch
)

if(BUILD_TESTING)
  find_package(ament_lint_auto REQUIRED)
  # the following line skips the linter which checks for copyrights
  # comment the line when a copyright and license is added to all source files
  set(ament_cmake_copyright_FOUND TRUE)
  # the following line skips cpplint (only works in a git repo)
  # comment the line when this package is in a git repo and when
  # a copyright and license is added to all source files
  set(ament_cmake_cpplint_FOUND TRUE)
  ament_lint_auto_find_test_dependencies()
endif()




ament_package()
